package com.zyy.smartcity1129.home;

import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.zyy.smartcity1129.BaseFragment;
import com.zyy.smartcity1129.R;
import com.zyy.smartcity1129.data.HouseInfo;
import com.zyy.smartcity1129.house.HouseFragment;
import com.zyy.smartcity1129.util.Http;

/**
 * @ClassName: House1Fragment$
 * @Description: 作用
 * @Author: letquit
 * @CreateDate: 2/12/2021$
 * @Version: 1.0
 */
public class House1Fragment extends BaseFragment {
    private ImageView ig;
    private TextView textView6;
    private TextView textView7;
    private TextView textView8;
    private TextView textView9;
    private TextView textView10;
    private TextView tv;
    private TextView tv1;
    private HouseInfo.RowsBean house = HouseFragment.house;

    @Override
    protected int layId() {
        return R.layout.f_house1;
    }

    @Override
    protected String title() {
        return "房源详情";
    }

    @Override
    protected boolean back() {
        return true;
    }

    @Override
    protected Boolean bottom() {
        return false;
    }

    @Override
    protected void init(View iv) {
        initView(iv);
        Glide.with(ig.getContext()).load(Http.base+house.getPic()).into(ig);
        textView6.setText(house.getSourceName());
        textView7.setText("房源面积："+house.getAreaSize()+"平方米");
        textView8.setText("价格："+house.getPrice());
        textView9.setText(house.getDescription());
        textView10.setText("房源类型："+house.getHouseType());
        tv.setOnClickListener(v->{remove();});
        tv1.setOnClickListener(v->{
            startActivity(new Intent(Intent.ACTION_DIAL).setData(Uri.parse("tel:" + house.getTel())));
        });
    }

    private void initView(View iv) {
        ig = (ImageView) iv.findViewById(R.id.ig);
        textView6 = (TextView) iv.findViewById(R.id.textView6);
        textView7 = (TextView) iv.findViewById(R.id.textView7);
        textView8 = (TextView) iv.findViewById(R.id.textView8);
        textView9 = (TextView) iv.findViewById(R.id.textView9);
        textView10 = (TextView) iv.findViewById(R.id.textView10);
        tv = (TextView) iv.findViewById(R.id.tv);
        tv1 = (TextView) iv.findViewById(R.id.tv1);
    }
}
